﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using  RTS.Model;
using IrrKlang;
using RTS;

namespace SoundsLibrary
{
    public class SoundLibraryModel
    {

        private List<Sound> _sounds;

        public void addSound(Sound s)
        {
            int id = s.ID;
            foreach (Sound item in this._sounds)
            {
            if(item.ID == id)
            {
                throw new Exception("Sound ID Conflict");}
            }
           
                
            }

        public void addSound(String path)
        {
            this.addSound(getMinAvailableId(), path, path.Substring(path.LastIndexOf("\\") + 1));  //remove path to keep filename
        }

        public void addSound(int id,String path,String name)
        {
            //check id
          //  ISound s = ISound.
        Sound s = new Sound(id,name,path,RTS.Tools.FileReader.ReadFile(path));
        
        }
        
        public int getMinAvailableId()
        {
        int minID = 0;
            foreach (Sound item in this._sounds)
	{
                if(item.ID ==  minID)
                {
                minID++; }
               

	}
             return minID;


        }

        }

    




    }
